﻿<div bsModal #createOrEditModal="bs-modal" (onShown)="onShown()" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="createOrEditModal" aria-hidden="true" [config]="{backdrop: 'static', keyboard: !saving}">
    <div class="modal-dialog modal-lg">
        <div class="modal-content">
            <form *ngIf="active" #userForm="ngForm" novalidate (ngSubmit)="save()" autocomplete="off">
                <div class="modal-header">
                    <h4 class="modal-title">
                        <span *ngIf="standardPartsDetail.id">编辑</span>
                        <span *ngIf="!standardPartsDetail.id">新建</span>
                    </h4>
                    <button type="button" class="close" (click)="close()" [attr.aria-label]="l('Close')" [disabled]="saving">
                        <span aria-hidden="true">&times;</span>
                    </button>
                </div>
                <div class="modal-body">
                    <tabset class="tab-container tabbable-line">
                        <tab heading="编码库信息" customClass="m-tabs__item">
                            <div class="row">
                                <!-- <div class="col-sm-6">
                                    <div class="form-group">
                                        <label for="code">编码</label>
                                        <input id="code" #codeInput="ngModel" class="form-control" type="text" name="code" [(ngModel)]="standardPartsDetail.id" required maxlength="255" >
                                        <validation-messages [formCtrl]="codeInput"></validation-messages>
                                    </div>
                                </div> -->
                                <div class="col-sm-6">
                                    <div class="form-group">
                                        <label for="name">名称 *</label>
                                        <input id="name" #nameInput="ngModel" type="text" name="name" class="form-control" [(ngModel)]="standardPartsDetail.features.displayName" required maxlength="255">
                                        <validation-messages [formCtrl]="nameInput"></validation-messages>
                                    </div>
                                </div>
                            </div>
                            <div class="row">
                                <div class="col-sm-6">
                                    <div class="form-group">
                                        <label for="standardType">分类 </label>
                                        <select  name="standardType"  class="form-control"  [(ngModel)]="standardPartsDetail.standardType"  required>
                                        <option *ngFor="let optionItem of standardTypes" [value]="optionItem.value">{{optionItem.text}}</option>
                                        </select>
                                    </div>
                                </div>
                                <div class="col-sm-6">
                                    <div class="form-group">
                                        <label for="standardNumber">标准 *</label>
                                        <input id="standardNumber" #standardNumberInput="ngModel" type="text" name="standard" class="form-control" [(ngModel)]="standardPartsDetail.features.standardNumber" required maxlength="256"/>
                                        <validation-messages [formCtrl]="standardNumberInput"></validation-messages>
                                    </div>
                                </div>
                            </div>
                            <div class="row">
                                <div class="col-sm-6">
                                    <div class="form-group">
                                        <label for="specification">规格 *</label>
                                        <input id="specification" #specificationInput="ngModel" type="text" name="specification" class="form-control" [(ngModel)]="standardPartsDetail.features.specification" required maxlength="255">
                                        <validation-messages [formCtrl]="specificationInput"></validation-messages>
                                    </div>
                                </div>
                                <div class="col-sm-6">
                                    <div class="form-group">
                                        <label for="material">材料 *</label>
                                        <input id="material" #materialInput="ngModel" type="text" name="material" class="form-control" [(ngModel)]="standardPartsDetail.features.materials" required maxlength="255">
                                        <validation-messages [formCtrl]="materialInput"></validation-messages>
                                    </div>
                                </div>
                            </div>
                            <div class="row">
                                <div class="col-sm-6">
                                    <div class="form-group">
                                        <label for="price">价格(元) *</label>
                                        <input id="price" #priceInput="ngModel" type="number" name="price" class="form-control" [(ngModel)]="standardPartsDetail.price" required oninput="if(value.length>9)value=value.slice(0,9)">
                                        <validation-messages [formCtrl]="priceInput"></validation-messages>
                                    </div>
                                </div>
                                <div class="col-sm-6">
                                    <div class="form-group">
                                        <label for="SafetyStock">安全库存量 </label>
                                        <input id="SafetyStock"  #safetyStockInput="ngModel" type="number" name="safetyStock" class="form-control" [(ngModel)]="standardPartsDetail.safetyStock"  oninput="if(value.length>9)value=value.slice(0,9)">
                                    </div>
                                </div>
                            </div>
                            <div class="row">
                                <div class="col-sm-6">
                                    <div class="form-group">
                                        <label for="isTempering">是否表面处理</label><br>
                                        <label class="m-checkbox">
                                            <input id="isTempering" type="checkbox" name="isTempering" [(ngModel)]="standardPartsDetail.isTempering">
                                            <span></span>
                                        </label>
                                    </div>
                                </div>
                            </div>
                        </tab>
                    </tabset>
                </div>
                <div class="modal-footer">
                    <button [disabled]="saving" type="button" class="btn btn-default" (click)="close()">{{"Cancel" | localize}}</button>
                    <button type="submit" class="btn btn-primary" [disabled]="!userForm.form.valid" [buttonBusy]="saving" [busyText]="l('SavingWithThreeDot')"><i class="fa fa-save"></i> <span>{{"Save" | localize}}</span></button>
                </div>
            </form>
        </div>
    </div>
</div>
